cmake_minimum_required(VERSION 2.8)

message("-- Project: asynio")

file(GLOB asynio_src "*.cpp")
file(GLOB aio_src "aio/*.c")
	
add_library(asynio SHARED ${aio_src} ${asynio_src})
set_target_properties(asynio PROPERTIES OUTPUT_NAME "asynio")

target_link_libraries(asynio stdcrt)
#target_link_libraries(asynio nettls)

include_directories(
		${PROJECT_SOURCE_DIR}/include
		${PROJECT_SOURCE_DIR}/crt
		${PROJECT_SOURCE_DIR}/nettls
		${PROJECT_SOURCE_DIR}/extensions/include
		${by3rd_library_include})

if (${WIN_OS})

	target_link_libraries(asynio shlwapi)
	target_link_libraries(asynio ws2_32)

	set(CMAKE_SHARED_LINKER_FLAGS 
		"${CMAKE_SHARED_LINKER_FLAGS} /DEF:${PROJECT_SOURCE_DIR}/asynio/dllexports.def")
else()

	include_directories(
		${PROJECT_SOURCE_DIR}/include
		${PROJECT_SOURCE_DIR}/crt
		${PROJECT_SOURCE_DIR}/nettls
		${PROJECT_SOURCE_DIR}/extensions/include
		${by3rd_library_include}
		/usr/local/include
		/opt/include
		/usr/include)

	set_target_properties(asynio PROPERTIES COMPILE_FLAGS ${dynamic})
	set_target_properties(asynio PROPERTIES COMPILE_FLAGS ${compile})
	set_target_properties(asynio PROPERTIES LINK_FLAGS ${r_path})

	if(${LINUX_OS})
		target_link_libraries(asynio dl)
	endif()

	if(${UNIX_OS})
		target_link_libraries(asynio)
	endif()


endif()




